package dcedit.util;

// Import Java SDK Classes
import java.awt.Insets;
import java.io.File;
import java.io.InputStream;
import javax.swing.JToggleButton;
import javax.swing.ImageIcon;
import javax.imageio.ImageIO;
import javax.imageio.stream.ImageInputStream;
import java.net.URL;

/** OmniToggleButton class */
public class OmniToggleButton extends JToggleButton {
    /** Serializable constant */
   public static final long serialVersionUID = 1289514893446L;

   /** Constructor */
   public OmniToggleButton(String img) {
      this(new File(img));
   } // END constructor

   /** Constructor */
   public OmniToggleButton(File img) {
      try {
         if(null != img) {
            this.setIcon(new ImageIcon(ImageIO.read(img)));
            this.setMargin(new Insets(0, 0, 0, 0));
         } // END if
      } catch(Exception e) {}
   } // END constructor

   /** Constructor */
   public OmniToggleButton(InputStream img) {
      try {
         if(null != img) {
            this.setIcon(new ImageIcon(ImageIO.read(img)));
            this.setMargin(new Insets(0, 0, 0, 0));
         } // END if
      } catch(Exception e) {}
   } // END constructor

   /** Constructor */
   public OmniToggleButton(ImageInputStream img) {
      try {
         if(null != img) {
            this.setIcon(new ImageIcon(ImageIO.read(img)));
            this.setMargin(new Insets(0, 0, 0, 0));
         } // END if
      } catch(Exception e) {}
   } // END constructor

   /** Constructor */
   public OmniToggleButton(URL img) {
      try {
         if(null != img) {
            this.setIcon(new ImageIcon(ImageIO.read(img)));
            this.setMargin(new Insets(0, 0, 0, 0));
         } // END if
      } catch(Exception e) {}
   } // END constructor
} // END class OmniToggleButton